<template>
	<view>
		<view v-if="resultList.length == 0">暂无报告</view>
		<view v-else>
			<scroll-view scroll-y="true" :style="{height: wh + 'px'}" @scrolltolower="scrollLower">
				<view  v-for="(item,index) in resultList" :key="index">
					<navigator class="result-list" :url="'/subpkg/result-detail/result-detail?orderId='+item.orderId">
						<!-- 左边logo -->
						<view>
							<uni-icons customPrefix="order" type="icon-hsjcyifabu" size="40" color="#09bb07"></uni-icons>
						</view>
						<!-- 右边信息 -->
						<view class="result-list-right">
							<view class="result-list-right-line">
								<view>{{item.hospName}}</view>
							</view>
							<view class="result-list-right-line">
								<view style="color: gray; font-size: 12px;">{{item.createTime}}</view>
							</view>
						</view>
					</navigator>
				</view>
				<uni-load-more :status="status"></uni-load-more>
			</scroll-view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				page:1,
				limit:8,
				totalPage:0,
				resultList:[],
				status:"more",
				wh:0,
			};
		},
		
		onLoad() {
			const sysInfo = uni.getSystemInfoSync()
			this.wh = sysInfo.windowHeight
			this.getOrderResultList()
		},
		created() {
			
		},
		methods:{
			getOrderResultList(){
				uni.request({
					url:'http://192.168.43.224:9002/orderresult/getOrderResultList/'+this.page+"/"+this.limit,
					method:'GET',
					success: (res) => {
						this.resultList = res.data.data.records
						this.totalPage = res.data.data.pages
						console.log(this.resultList)
					}
				})
			},
			
			scrollLower() {
				console.log('触发了')
			    if (this.page >= this.totalPage) {
			       this.status = "noMore"
			       return
			    } else {
			       this.status = "loading"
			    }
			    this.page++
			    this.timer = setTimeout(() => {
					this.getOrderList()
			    }, 200)
			    console.log('我滚动到底部了')
			},
		}
	}
</script>

<style lang="scss">
.result-list{
	margin-top: 10px;
	width: 100%;
	height: 75px;
	display: flex;
	background-color: #EBEEF5;
	box-shadow: 5rpx #C0C4CC;
	// justify-content: center;
	align-items: center;
	padding-left: 15px;
}
.result-list-right{
	height: 100%;
	width: 100%;
	margin: 5px 10px;
	.result-list-right-line{
		display: flex;
		justify-content: space-between;
		padding-left: 10px;
		padding-right: 20px;
		padding-top: 10px;
		.result-list-right-line-price{
			color: #F0AD4E;
		}
	}
}
</style>
